// 宠物健康管理相关 API
// 使用统一的请求封装

import request from '@/utils/request';

// 获取健康记录列表
export function getHealthList(params = {}) {
  return request({
    url: '/system/health/list',
    method: 'GET',
    params: params
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 获取健康记录详情
export function getHealthDetail(recordId) {
  return request({
    url: `/system/health/${recordId}`,
    method: 'GET'
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 添加健康记录
export function addHealthRecord(data) {
  return request({
    url: '/system/health',
    method: 'POST',
    data
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 更新健康记录
export function updateHealthRecord(recordId, data) {
  return request({
    url: '/system/health',
    method: 'PUT',
    data: {
      ...data,
      id: recordId
    }
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 删除健康记录
export function deleteHealthRecord(recordId) {
  return request({
    url: `/system/health/${recordId}`,
    method: 'DELETE'
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}